﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using famails.iface;
using famails.dao;
using famails.App_Code.source.dto;
namespace famails.bus
{
    /// <summary>
    /// Summary description for ProductGroupBUS
    /// </summary>
    public class CM_ProductGroupBUS : ICM_ProductGroup
    {
        CM_ProductGroupDAO cateDao;
        public CM_ProductGroupBUS()
        {
            cateDao = new CM_ProductGroupDAO();
        }

        #region IProductGroup Members

        public DataTable GetByID(int ID,int userID)
        {
            return cateDao.GetByID(ID, userID);
        }

        #endregion


        public DataTable GetAll(int userID)
        {
            return cateDao.GetAll(userID);
        }

        public bool Insert(CM_ProductGroupDTO dto)
        {
            return cateDao.Insert(dto);
        }

        public bool Edit(CM_ProductGroupDTO dto)
        {
            return cateDao.Edit(dto);
        }

        public bool Delete(int id)
        {
            return cateDao.Delete(id);
        }

        public bool CheckExistsName(string name, int id)
        {
            return cateDao.CheckExistsName(name, id);
        }

        public bool CheckBeforeDelete(int id)
        {
            return cateDao.CheckBeforeDelete(id);
        }

        internal DataTable GetProductGroup(int userid, int groupstep)
        {
            return cateDao.GetProductGroup(userid, groupstep);
        }

        internal DataTable GetParentGroup(string GroupStep, int userid)
        {
            return cateDao.GetParentGroup(userid, GroupStep);
        }

        internal DataTable GetChildGroup(int parentid, int groupstep, int userid)
        {
            return cateDao.GetChildGroup(parentid,groupstep,userid);
        }
    }
}